package com.tledu.mapper;

import com.tledu.model.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface UserMapper {

    @Select("select *,user_id as userId ,role_id roleId from shop_user where username = #{username} and password = #{password}")
    User login(User user);

    @Insert("insert into shop_user(username,password) values(#{username},#{password})")
    void register(User user);

    @Select("select * from shop_user where username = #{username}")
    List<User> selectByUserName(String username);

    User selectByUserId(String userId);

    void update(User user);

    void addressAdd(User user);
}
